package com.maila.xiaoaoschool.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.maila.xiaoaoschool.R;
import com.maila.xiaoaoschool.widget.NoScrollListView;
import com.zhy.autolayout.AutoRelativeLayout;
import com.zhy.autolayout.utils.AutoUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/10/30.
 */

public class OrderAdapter extends BaseAdapter {
    Context context;

    public OrderAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder = null;


        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_all_kinds_of_user_order, viewGroup, false);
            viewHolder = new ViewHolder(view);
            view.setTag(viewHolder);
            AutoUtils.autoSize(view);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        viewHolder.allKindsOfOrderLv.setAdapter(new ItemAdapter(context));
        return view;
    }

    static class ViewHolder {
        @BindView(R.id.store_name)
        TextView storeName;
        @BindView(R.id.status_messages)
        TextView statusMessages;
        @BindView(R.id.all_kinds_of_order_lv)
        NoScrollListView allKindsOfOrderLv;
        @BindView(R.id.commodity_freight)
        TextView commodityFreight;
        @BindView(R.id.commodity_total_prices)
        TextView commodityTotalPrices;
        @BindView(R.id.quantity_of_commodity)
        TextView quantityOfCommodity;
        @BindView(R.id.tv_right)
        TextView tvRight;
        @BindView(R.id.tv_center)
        TextView tvCenter;
        @BindView(R.id.tv_left)
        TextView tvLeft;
        @BindView(R.id.user_action_bar)
        AutoRelativeLayout userActionBar;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }



    private class ItemAdapter extends BaseAdapter {
        private Context context;


        ItemAdapter(Context context) {
            this.context = context;

        }

        @Override
        public int getCount() {
            return 6;
        }

        @Override
        public Object getItem(int i) {
            return null;
        }

        @Override
        public long getItemId(int i) {
            return 0;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
            ViewHolder viewHolder = null;
            if (view == null) {
                view = LayoutInflater.from(context).inflate(R.layout.item_all_kinds_of_order, viewGroup, false);
                viewHolder = new ViewHolder(view);
                view.setTag(viewHolder);
                AutoUtils.autoSize(view);
            } else {
                viewHolder = (ViewHolder) view.getTag();
            }

            return view;
        }

        class ViewHolder {
            private ImageView commodity_icon;
            private TextView commodity_name, article_category, commodity_price, commodity_original_price, commodity_count;

            public ViewHolder(View itemView) {
                commodity_icon = (ImageView) itemView.findViewById(R.id.commodity_icon);
                commodity_name = (TextView) itemView.findViewById(R.id.commodity_name);
                article_category = (TextView) itemView.findViewById(R.id.article_category);
                commodity_price = (TextView) itemView.findViewById(R.id.commodity_price);
                commodity_count = (TextView) itemView.findViewById(R.id.commodity_count);
            }
        }
    }




}
